package models

// Order 订单表
type Order struct {
	BaseModel
	OrderNo     string  `gorm:"size:50;uniqueIndex;not null" json:"order_no"`
	UserID      uint    `gorm:"not null;index" json:"user_id"`
	Type        string  `gorm:"size:20;not null;comment:订单类型 course课程" json:"type"`
	RelatedID   uint    `gorm:"not null;comment:关联ID" json:"related_id"`
	RelatedName string  `gorm:"size:255;comment:关联名称" json:"related_name"`
	Amount      float64 `gorm:"type:decimal(10,2);default:0.00" json:"amount"`
	Status      string  `gorm:"size:20;default:待支付" json:"status"`
	PayTime     string  `gorm:"size:50" json:"pay_time"`
	PayMethod   string  `gorm:"size:20" json:"pay_method"`
	Remark      string  `gorm:"type:text" json:"remark"`

	// 关联
	User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
}

func (Order) TableName() string {
	return "go_order"
}
